include("shared.lua");
language.Add("staff_pulse_stationary_DC","Planetary Defence Cannon");

--################### Init @aVoN
function ENT:Initialize()
	self.BaseClass.Initialize(self);
	self.Sizes={48,48,250};
end

--################### Think @aVoN
function ENT:Think()
	-- Retrive data like color/draw shaft from the cannon's settings!
	if(not self.Parent) then
		local dist = 1337;
		local pos = self.Entity:GetPos();
		if(pos ~= Vector(0,0,0)) then
			for _,v in pairs(ents.FindByClass("defence_cannon_glider_DC")) do
				local len = (v:GetPos()-pos):Length();
				if(len < dist) then
					self.Parent = v;
					dist = len;
				end
			end
		end
		if(ValidEntity(self.Parent)) then
			self.DrawShaft = self.Parent:GetNWBool("shaft",true);
			self.StartPos = self.Parent:GetPos(); -- Necessary for drawing the shaft when the shot actually isn't yet at any velocity clientside
		end
	end
	self.BaseClass.Think(self);
end
